package com.luohoufa.ms.user.utils;


import com.luohoufa.ms.user.enums.ResultEnum;
import com.luohoufa.ms.user.vo.ResultVO;

public class ResultVOUtil {

    public static ResultVO build(ResultEnum resultEnum) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(resultEnum.getCode());
        resultVO.setMessage(resultEnum.getMessage());
        return resultVO;
    }

    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMessage("成功");
        resultVO.setData(object);
        return resultVO;
    }

    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMessage("成功");
        return resultVO;
    }

    public static ResultVO error(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(-1);
        resultVO.setMessage("失败");
        resultVO.setData(object);
        return resultVO;
    }

}
